//
//  UIImage+Category.h
//  YLB
//
//  Created by Zoo Chow on 14/02/2017.
//  Copyright © 2017 Zoo. All rights reserved.
//

#import <UIKit/UIKit.h>

#define YLPlaceholderImageName @"yl-default-placeholder"
#define YLDefaultLogoImageName @"yl-default-logo"

@class AVURLAsset;

@interface UIImage (Category)

/**
 *  使用颜色生成纯色图片
 */
+ (UIImage*)imageOfPixelWithColor:(UIColor *)color;
+ (UIImage*)imageOfPixelWithColor:(UIColor*)color size:(CGSize)size;
+ (UIImage*)imageOfPixelWithUpCircleColor:(UIColor*)color size:(CGSize)size;
+ (UIImage*)imageOfPixelWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)radius;
/**
 *  模糊图片
 */
- (UIImage*)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;
/**
 *  image tint color
 *
 *  @param tintColor tint color
 *
 *  @return image
 */
- (UIImage*)imageWithTintColor:(UIColor *)tintColor;
/**
 *  image add gradient tint color
 *
 *  @param tintColor new color for image face
 *
 *  @return image
 */
- (UIImage*)imageWithGradientTintColor:(UIColor *)tintColor;
- (UIImage*)imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode;
/**
 * image have a center text
 */
+ (UIImage*)imageWithCenterText:(NSString*)text textColor:(UIColor*)textColor size:(CGSize)size;
/**
 *  represent image data
 *
 *  @return image data
 */
- (NSData *)imageRepresentData;
/**
 * image have background circle
 */
- (UIImage*)imageWithCircle:(UIColor*)color;
- (UIImage*)imageWithBorderCircle:(UIColor*)color offset:(CGFloat)offset;
- (UIImage*)imageWithRect:(UIColor*)color;
- (UIImage*)imageInsertWithSize:(CGSize)size backgroundColor:(UIColor*)color;
- (UIImage*)imageInsertCircleWithSize:(CGSize)size backgroundColor:(UIColor*)color;
/**
 * create Sudoku image
 */
+ (UIImage*)imageSudokuWithImages:(NSArray<UIImage*>*)images backgroundColor:(UIColor*)backgroundColor;
/**
 * create add image
 */
+ (UIImage*)imageAddShapeWithColor:(UIColor*)color size:(CGSize)size;
// 图片旋转
- (UIImage *)imageRotation:(UIImageOrientation)orientation;
/*
 * get image from url
 */
+ (UIImage*)imageUsingUrl:(AVURLAsset*)urlAsset;
/*
 * scale image
 */
- (UIImage*)scaleImageUsingSize:(CGSize)size;
/*
 * 获取某一点的颜色
 */
- (UIColor*)colorAtPoint:(CGPoint)point;
/**
 get image in budle
 
 @param name image name
 @param bundle bundle name
 @return image
 */
+ (UIImage*)bundleImageWithName:(NSString*)name bundle:(NSString*)bundle;

/**
 create line gradient image

 @param colors gradient colors
 @return image
 */
+ (UIImage*)imageOfLineGradient:(NSArray*)colors;
+ (UIImage*)imageOfLineGradient:(NSArray*)colors topColor:(UIColor*)color height:(CGFloat)height;

/**
 gif image

 @return gif images
 */
+ (NSArray<UIImage*>*)anmatedImagesFromData:(NSData*)data;

@end



















































